//
//  UILabel+Lc.m
//  18Birdies
//
//  Created by Lc on 15/3/31.
//  Copyright (c) 2015年 Lc. All rights reserved.
//

#import "LcFont.h"
#import "LcPreconditions.h"
#import "UILabel+Lc.h"
#import "LcText.h"

@implementation UILabel (Lc)

- (void)setLcFont:(LcFont*)lcFont {
  LC_CHECK_NOT_NULL(lcFont);
  self.font = lcFont.font;
  self.textColor = lcFont.color;
}

- (void)setLcText:(LcText*)lcText {
  self.text = lcText.text;
  if (lcText.lcFont != nil) {
    [self setLcFont:lcText.lcFont];
  }
}

- (void)enableBorderWithColor:(UIColor*)color {
  LC_CHECK_NOT_NULL(color);
  self.layer.cornerRadius = 2;
  self.layer.borderWidth = 1;
  self.layer.borderColor = color.CGColor;
  self.layer.masksToBounds = YES;
}

- (void)awakeFromNib {
  [super awakeFromNib];
  //  if (self.numberOfLines != 1 &&
  //      [UIDevice currentDevice].systemVersion.floatValue >= 8) {
  //    self.preferredMaxLayoutWidth = 0;
  //  }
}

@end
